        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>TimeOfImpactSolverManifold class / box2d Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d" data-type="TimeOfImpactSolverManifold">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d.html">box2d</a> &rsaquo; <a href="../box2d/TimeOfImpactSolverManifold.html">TimeOfImpactSolverManifold</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>TimeOfImpactSolverManifold</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<pre class="source">
class TimeOfImpactSolverManifold {
 final vec2 normal;
 final vec2 point;
 num separation;

 /** Pooling */
 final vec2 pointA;
 final vec2 pointB;
 final vec2 temp;
 final vec2 planePoint;
 final vec2 clipPoint;

 /** constructor that initiliazes everything. */
 TimeOfImpactSolverManifold() :
   normal = new vec2.zero(),
   point = new vec2.zero(),
   separation = 0,
   pointA = new vec2.zero(),
   pointB = new vec2.zero(),
   temp = new vec2.zero(),
   planePoint = new vec2.zero(),
   clipPoint = new vec2.zero() { }

 void initialize(TimeOfImpactConstraint cc, int index) {
   assert(cc.pointCount &gt; 0);

   switch (cc.type) {
     case ManifoldType.CIRCLES:
       pointA.copyFrom(cc.bodyA.getWorldPoint(cc.localPoint));
       pointB.copyFrom(cc.bodyB.getWorldPoint(cc.localPoints[0]));
       if (distance2(pointA, pointB) &gt; Settings.EPSILON * Settings.EPSILON) {
         normal.copyFrom(pointB).sub(pointA);
         normal.normalize();
       } else {
         normal.splat(0.0);
       }

       point.copyFrom(pointA).add(pointB).scale(.5);
       temp.copyFrom(pointB).sub(pointA);
       separation = dot(temp, normal) - cc.radius;
       break;

     case ManifoldType.FACE_A:
       normal.copyFrom(cc.bodyA.getWorldVector(cc.localNormal));
       planePoint.copyFrom(cc.bodyA.getWorldPoint(cc.localPoint));

       clipPoint.copyFrom(cc.bodyB.getWorldPoint(cc.localPoints[index]));
       temp.copyFrom(clipPoint).sub(planePoint);
       separation = dot(temp, normal) - cc.radius;
       point.copyFrom(clipPoint);
       break;

     case ManifoldType.FACE_B:
       normal.copyFrom(cc.bodyB.getWorldVector(cc.localNormal));
       planePoint.copyFrom(cc.bodyB.getWorldPoint(cc.localPoint));

       clipPoint.copyFrom(cc.bodyA.getWorldPoint(cc.localPoints[index]));
       temp.copyFrom(clipPoint).sub(planePoint);
       separation = dot(temp, normal) - cc.radius;
       point.copyFrom(clipPoint);

       // Ensure normal points from A to B
       normal.negate();
       break;
   }
 }
}
</pre>
</div>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="TimeOfImpactSolverManifold">
<button class="show-code">Code</button>
new <strong>TimeOfImpactSolverManifold</strong>() <a class="anchor-link" href="#TimeOfImpactSolverManifold"
              title="Permalink to TimeOfImpactSolverManifold.TimeOfImpactSolverManifold">#</a></h4>
<div class="doc">
<p>constructor that initiliazes everything. </p>
<pre class="source">
TimeOfImpactSolverManifold() :
 normal = new vec2.zero(),
 point = new vec2.zero(),
 separation = 0,
 pointA = new vec2.zero(),
 pointB = new vec2.zero(),
 temp = new vec2.zero(),
 planePoint = new vec2.zero(),
 clipPoint = new vec2.zero() { }
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field"><h4 id="clipPoint">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>clipPoint</strong> <a class="anchor-link"
            href="#clipPoint"
            title="Permalink to TimeOfImpactSolverManifold.clipPoint">#</a>
        </h4>
        <div class="doc">
<pre class="source">
clipPoint
</pre>
</div>
</div>
<div class="field"><h4 id="normal">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>normal</strong> <a class="anchor-link"
            href="#normal"
            title="Permalink to TimeOfImpactSolverManifold.normal">#</a>
        </h4>
        <div class="doc">
<pre class="source">
normal
</pre>
</div>
</div>
<div class="field"><h4 id="planePoint">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>planePoint</strong> <a class="anchor-link"
            href="#planePoint"
            title="Permalink to TimeOfImpactSolverManifold.planePoint">#</a>
        </h4>
        <div class="doc">
<pre class="source">
planePoint
</pre>
</div>
</div>
<div class="field"><h4 id="point">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>point</strong> <a class="anchor-link"
            href="#point"
            title="Permalink to TimeOfImpactSolverManifold.point">#</a>
        </h4>
        <div class="doc">
<pre class="source">
point
</pre>
</div>
</div>
<div class="field"><h4 id="pointA">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>pointA</strong> <a class="anchor-link"
            href="#pointA"
            title="Permalink to TimeOfImpactSolverManifold.pointA">#</a>
        </h4>
        <div class="doc">
<pre class="source">
pointA
</pre>
</div>
</div>
<div class="field"><h4 id="pointB">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>pointB</strong> <a class="anchor-link"
            href="#pointB"
            title="Permalink to TimeOfImpactSolverManifold.pointB">#</a>
        </h4>
        <div class="doc">
<pre class="source">
pointB
</pre>
</div>
</div>
<div class="field"><h4 id="separation">
<button class="show-code">Code</button>
num         <strong>separation</strong> <a class="anchor-link"
            href="#separation"
            title="Permalink to TimeOfImpactSolverManifold.separation">#</a>
        </h4>
        <div class="doc">
<pre class="source">
separation
</pre>
</div>
</div>
<div class="field"><h4 id="temp">
<button class="show-code">Code</button>
final <a href="../vector_math/vec2.html">vec2</a>         <strong>temp</strong> <a class="anchor-link"
            href="#temp"
            title="Permalink to TimeOfImpactSolverManifold.temp">#</a>
        </h4>
        <div class="doc">
<pre class="source">
temp
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method"><h4 id="initialize">
<button class="show-code">Code</button>
void <strong>initialize</strong>(<a href="../box2d/TimeOfImpactConstraint.html">TimeOfImpactConstraint</a> cc, int index) <a class="anchor-link" href="#initialize"
              title="Permalink to TimeOfImpactSolverManifold.initialize">#</a></h4>
<div class="doc">
<pre class="source">
void initialize(TimeOfImpactConstraint cc, int index) {
 assert(cc.pointCount &gt; 0);

 switch (cc.type) {
   case ManifoldType.CIRCLES:
     pointA.copyFrom(cc.bodyA.getWorldPoint(cc.localPoint));
     pointB.copyFrom(cc.bodyB.getWorldPoint(cc.localPoints[0]));
     if (distance2(pointA, pointB) &gt; Settings.EPSILON * Settings.EPSILON) {
       normal.copyFrom(pointB).sub(pointA);
       normal.normalize();
     } else {
       normal.splat(0.0);
     }

     point.copyFrom(pointA).add(pointB).scale(.5);
     temp.copyFrom(pointB).sub(pointA);
     separation = dot(temp, normal) - cc.radius;
     break;

   case ManifoldType.FACE_A:
     normal.copyFrom(cc.bodyA.getWorldVector(cc.localNormal));
     planePoint.copyFrom(cc.bodyA.getWorldPoint(cc.localPoint));

     clipPoint.copyFrom(cc.bodyB.getWorldPoint(cc.localPoints[index]));
     temp.copyFrom(clipPoint).sub(planePoint);
     separation = dot(temp, normal) - cc.radius;
     point.copyFrom(clipPoint);
     break;

   case ManifoldType.FACE_B:
     normal.copyFrom(cc.bodyB.getWorldVector(cc.localNormal));
     planePoint.copyFrom(cc.bodyB.getWorldPoint(cc.localPoint));

     clipPoint.copyFrom(cc.bodyA.getWorldPoint(cc.localPoints[index]));
     temp.copyFrom(clipPoint).sub(planePoint);
     separation = dot(temp, normal) - cc.radius;
     point.copyFrom(clipPoint);

     // Ensure normal points from A to B
     normal.negate();
     break;
 }
}
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
